class Solution {
public:
    bool canConstruct(string ransomNote, string magazine) {
        int a[26]={0},b[26]={0};
        for(auto i:ransomNote){
            a[i-'a']++;
    }
        for(auto i : magazine){
            b[i-'a']++;
        }
        int flag=1;
        for(int i=0;i<26;i++){
            if(a[i]>b[i]){
                flag=0;
                break;
            }
        }
        if(flag)return true;
        return false;
    }
};
